

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.io.Serializable;
import java.util.LinkedList;

public class FreehandObject extends ShapeObject implements Serializable{

	protected LinkedList LineList;
	
	public FreehandObject(Point startingMousePosition,Point endingMousePosition, Color color, LinkedList LineList) {
		super(startingMousePosition, endingMousePosition, color);
		this.LineList = LineList;
	}

	protected DrawingCanvas canvas;

	
	public void drawShape(DrawingCanvas canvas){
	

	    for(int i = 0; i < LineList.size(); i++){
	    	((LineObject)LineList.get(i)).drawShape(canvas);
	    }
	    canvas.repaint();
	}
	public void moveObject(int x, int y){
		int sx = this.startingMousePosition.x;
		int sy = this.startingMousePosition.y;
		super.moveObject(x, y);
		LineObject lObj = ((LineObject)LineList.get(0));
		lObj.lineStart.x += this.startingMousePosition.x-sx;
		lObj.lineStart.y += this.startingMousePosition.y-sy;
		for(int i = 0; i < LineList.size(); i++){
			lObj = ((LineObject)LineList.get(i));
			lObj.startingMousePosition.x += this.startingMousePosition.x-sx;
			lObj.startingMousePosition.y += this.startingMousePosition.y-sy;
			lObj.endingMousePosition.x += this.startingMousePosition.x-sx;
			lObj.endingMousePosition.y += this.startingMousePosition.y-sy;
			lObj.lineEnd.x += this.startingMousePosition.x-sx;
			lObj.lineEnd.y += this.startingMousePosition.y-sy;
	    }
	}
	public void setColor(Color c){
		for(int i = 0; i < LineList.size(); i++){
	    	((LineObject)LineList.get(i)).setColor(c);
	    }
	}
	public boolean isResizeable() {
		return false;
	}
}
